package java基础知识.java常用类;

import java.util.Arrays;

/**
 * @author coderFu
 * @create 2022/3/9
 * String 的 常用用法
 */
public class CoderString {

    public static void main(String[] args) {

        String a = new String("123");
        System.out.println(a);
        String  b = "abc";
        String str  = "a,b,n,n,n,n,nn,v";
        String[] split = str.split(",");
        System.out.println(Arrays.toString(split));
        String substring = str.substring(0, 3);
        System.out.println(substring);
        String n = substring.replace("n", "**");
        System.out.println(substring);

        String  c = a+b;
        System.out.println(c);

        // String 的
        String intern = c.intern();


        String A =  new String("ab");
        String B = new String("ab");
        String C = "ab";
        System.out.println("=============");
        System.out.println(A.intern() == B);
        String intern1 = A.intern();
        System.out.println(intern1);

        System.out.println(A.intern() == C);

    }
}
